local _, GrifonOvaleScripts = ...

GrifonOvaleScripts.script.PRIEST.Attilio = {
	desc = "[5.4] Attilio: Shadow-Discipline Priest",
	code =
[[

Define(angelic_feather 121536)
  SpellInfo(angelic_feather duration=6 cd=10 charge=3)

Define(berserking 26297)
  SpellInfo(berserking duration=10 cd=180 )
  SpellAddBuff(berserking berserking=1)
#Define(cascade 120785)
Define(cascade 121135)
  SpellInfo(cascade cd=25)
Define(devouring_plague 2944)
  SpellInfo(devouring_plague duration=6 tick=1 shadoworbs=1 haste=spell )
  SpellAddTargetDebuff(devouring_plague devouring_plague=1)
Define(dispersion 47585)
  SpellInfo(dispersion duration=6 cd=120 )
  SpellAddBuff(dispersion dispersion=1)
Define(divine_insight_shadow 124430)
  SpellInfo(divine_insight_shadow duration=12 )
  SpellAddBuff(divine_insight_shadow divine_insight_shadow=1)
Define(divine_star 110744)
  SpellInfo(divine_star cd=15 )
Define(halo 120517)
  SpellInfo(halo duration=5.5 cd=40 )
Define(inner_fire 588)
  SpellAddBuff(inner_fire inner_fire=1)
Define(inner_will 73413)
  SpellAddBuff(inner_will inner_will=1)
Define(mind_blast 8092)
  SpellInfo(mind_blast shadoworbs=-1 cd=8)
Define(mind_flay 15407)
  SpellInfo(mind_flay duration=3 )
  SpellAddTargetDebuff(mind_flay mind_flay=1)
Define(mind_flay_insanity 129197)
  SpellInfo(mind_flay_insanity duration=3 tick=1 )
  SpellAddTargetDebuff(mind_flay_insanity mind_flay_insanity=1)
Define(mind_sear 48045)
  SpellInfo(mind_sear duration=5 canStopChannelling=1 )
  SpellAddBuff(mind_sear mind_sear=1)
Define(mind_spike 73510)
Define(mindbender 123040)
  SpellInfo(mindbender duration=15 cd=60 )
Define(power_infusion 10060)
  SpellInfo(power_infusion duration=20 cd=120 )
  SpellAddBuff(power_infusion power_infusion=1)
Define(power_word_fortitude 21562)
  SpellInfo(power_word_fortitude duration=3600 )
  SpellAddBuff(power_word_fortitude power_word_fortitude=1)
Define(shadow_word_death 32379)
  SpellInfo(shadow_word_death cd=8 )
Define(shadow_word_pain 589)
  SpellInfo(shadow_word_pain duration=18 tick=3 haste=spell )
  SpellAddTargetDebuff(shadow_word_pain shadow_word_pain=1)
Define(shadowfiend 34433)
  SpellInfo(shadowfiend duration=12 cd=180 )
Define(shadowform 15473)
  SpellAddBuff(shadowform shadowform=1)
Define(surge_of_darkness 87160)
  SpellInfo(surge_of_darkness duration=10 )
  SpellAddBuff(surge_of_darkness surge_of_darkness=1)
Define(vampiric_embrace 15286)
  SpellInfo(vampiric_embrace duration=15 cd=180 )
  SpellAddBuff(vampiric_embrace vampiric_embrace=1)
Define(vampiric_touch 34914)
  SpellInfo(vampiric_touch duration=15 tick=3 haste=spell )
  SpellAddTargetDebuff(vampiric_touch vampiric_touch=1)




Define(EVANGELISM 81661)

Define(ARCHANGEL 81700)
SpellInfo(ARCHANGEL duration=18 cd=30 )
SpellAddBuff(ARCHANGEL ARCHANGEL=1)

Define(INNER_FOCUS 89485)
SpellInfo(INNER_FOCUS cd=45 )
SpellAddBuff(INNER_FOCUS INNER_FOCUS=1)

Define(HYMN_OF_HOPE 64901)
SpellInfo(HYMN_OF_HOPE cd=360 )

Define(PRAYER_OF_HEALING 596)

Define(PRAYER_OF_MENDING 33076)
SpellInfo(PRAYER_OF_MENDING cd=10)

Define(PRAYER_OF_MENDING_BUFF 41635)

Define(POWER_WORD_SHIELD 17)

Define(WEAKENED_SOUL 6788)

Define(POWER_WORD_SOLACE 129250)
SpellInfo(POWER_WORD_SOLACE cd=10)

Define(HOLY_FIRE 14914)
SpellInfo(HOLY_FIRE cd=10)      

Define(PAIN_SUPPRESSION 33206)
SpellInfo(PAIN_SUPPRESSION cd=180) 
 
Define(PENANCE 47540)
SpellInfo(PENANCE cd=9) 

Define(PURIFY 527)
SpellInfo(PURIFY cd=8) 

Define(FLASH_HEAL 2061)

Define(GREATER_HEAL 2060)

Define(HEAL 2050)

Define(RENEW 139)

Define(BINDING_HEAL 32546)

Define(DESPERATE_PRAYER 19236)
SpellInfo(DESPERATE_PRAYER cd=120)

Define(SMITE 585)

Define(FADE 586)
SpellInfo(FADE cd=30)


Define(VOID_SHIFT 108968)
SpellInfo(VOID_SHIFT cd=300)

Define(SPIRIT_SHELL 109964)

#Define(SPIRIT_SHELL_BUFF 109964)

Define(lifeblood 121279)

SpellInfo(lifeblood duration=20 cd=120 )

Define(glyph_of_penance 119866)

Define(cascade_talent 16)
Define(divine_star_talent 17)
Define(halo_talent 18)
Define(mindbender_talent 8)
Define(power_infusion_talent 14)
Define(body_and_soul_talent 4)
Define(angelic_feather_talent 5)
Define(insanity_talent 9)

AddCheckBox(AutoHalo "AutoHalo" specialization=3 default)
AddCheckBox(AutoMoveBuff "AutoMoveBuff" default)
AddCheckBox(AutoHealingHelp "AutoHealingHelp" specialization=3 default)
AddCheckBox(AutoInterrupt "AutoInterrupt" specialization=3 default)
AddCheckBox(AutoLifeblood "AutoLifeblood" )
AddCheckBox(AutoShieldTank "AutoShieldTank"  specialization=1 default)
AddCheckBox(AutoPoHonSpiritShell "AutoPoHonSpiritShell"  specialization=1 default)
AddCheckBox(AutoDistanceCalculate "AutoDistanceCalculate"  specialization=1 defalut )



##############
### SHADOW ###
##############

AddFunction BuffMe
{
	if not BuffPresent(stamina any=1) Spell(power_word_fortitude)
	if BuffExpires(inner_fire) and BuffExpires(inner_will) Spell(inner_fire)
	if BuffExpires(shadowform) Spell(shadowform)
}


AddFunction Interrupt
{
	if CheckBoxOn(AutoInterrupt) and {target.IsFriend(no) or {target.IsFriend() and target.IsCharmed()} } and target.IsInterruptible()
	{
		if target.InRange(silence) Spell(silence)
		#UseRacialInterruptActions()
	}
}

AddIcon specialization=3 help=main
{	
	BuffMe()
        Interrupt()
	ManaAndHealth()
	if Speed(more 0) and InCombat() MovingDPS()
        if Speed(more 0) and CheckBoxOn(AutoMoveBuff) 
	{
		if TalentPoints(angelic_feather_talent) and not BuffPresent(121557) Spell(angelic_feather)
	}	
	if ShadowOrbs() ==3 and {SpellCooldown(mind_blast) <1.5 or target.HealthPercent() <20 and SpellCooldown(shadow_word_death) <1.5 } Spell(devouring_plague)
	if Speed() == 0
	{
		if CheckBoxOn(AutoLifeblood) Spell(lifeblood)
		if target.DebuffPresent(devouring_plague) Spell(mind_flay_insanity)
		if target.HealthPercent(less 20) Spell(shadow_word_death)
        	if BuffStacks(divine_insight_shadow) and ShadowOrbs() < 3 Spell(mind_blast)
		if BuffStacks(surge_of_darkness) ==2 Spell(mind_spike)
                Spell(mind_flay_insanity)
		Spell(mind_blast)
		if not target.DebuffPresent(shadow_word_pain) Spell(shadow_word_pain)
		if target.DebuffRemains(vampiric_touch) < CastTime(vampiric_touch) Spell(vampiric_touch)		
		if target.TicksRemain(shadow_word_pain) <=1 Spell(shadow_word_pain)
		if target.DebuffRemains(vampiric_touch) <CastTime(vampiric_touch) +TickTime(vampiric_touch) Spell(vampiric_touch)
		if ShadowOrbs() ==3 and target.TicksRemain(devouring_plague) <=1 Spell(devouring_plague)
		if CheckBoxOn(AutoHalo) and TalentPoints(halo_talent) Spell(halo)
		if TalentPoints(cascade_talent) Spell(cascade)
		if TalentPoints(divine_star_talent) Spell(divine_star)
		if BuffStacks(surge_of_darkness) Spell(mind_spike)
		Spell(mind_flay)
	}

}

AddFunction MovingDPS
{
	if target.HealthPercent(less 20) Spell(shadow_word_death)
        if BuffStacks(surge_of_darkness) Spell(mind_spike)
	if BuffStacks(divine_insight_shadow) and ShadowOrbs() < 3 Spell(mind_blast)
        if ShadowOrbs() ==3 and target.TicksRemain(devouring_plague) <=1 Spell(devouring_plague)
	if not target.DebuffPresent(shadow_word_pain) Spell(shadow_word_pain)
        if CheckBoxOn(AutoHalo) and TalentPoints(halo_talent) Spell(halo)
	if TalentPoints(cascade_talent) Spell(cascade)
	if TalentPoints(divine_star_talent) Spell(divine_star)
}

AddFunction ManaAndHealth
{
	if ManaPercent() < 95
	{
		if TalentPoints(mindbender_talent) Spell(mindbender)
		if not TalentPoints(mindbender_talent) Spell(shadowfiend)
		if TalentPoints(power_infusion_talent) Spell(power_infusion)
	}
	if CheckBoxOn(AutoHealingHelp)
	{
        	if player.HealthPercent() <= 50 Spell(vampiric_embrace)
		if player.HealthPercent() <= 20 or ManaPercent() < 10 Spell(dispersion)
	}
}


##############
### DISCI  ###
##############

#PainSuppression
AddListItem(PainSuppression ps0 "PainSuppressionHP 0" specialization=1)
AddListItem(PainSuppression ps1 "PainSuppressionHP 10" specialization=1)
AddListItem(PainSuppression ps2 "PainSuppressionHP 20" specialization=1)
AddListItem(PainSuppression ps3 "PainSuppressionHP 30" specialization=1)
AddListItem(PainSuppression ps4 "PainSuppressionHP 40" specialization=1)
AddListItem(PainSuppression ps5 "PainSuppressionHP 50"  specialization=1 default)
AddListItem(PainSuppression ps6 "PainSuppressionHP 60" specialization=1)
AddListItem(PainSuppression ps7 "PainSuppressionHP 70" specialization=1)
AddListItem(PainSuppression ps8 "PainSuppressionHP 80" specialization=1)
AddListItem(PainSuppression ps9"PainSuppressionHP 90" specialization=1)
AddListItem(PainSuppression ps10"PainSuppressionHP 100" specialization=1)

AddFunction PainSuppressionValue asValue=1
{
	if List(PainSuppression ps0) 0
	if List(PainSuppression ps1) 10
	if List(PainSuppression ps2) 20
	if List(PainSuppression ps3) 30
	if List(PainSuppression ps4) 40
	if List(PainSuppression ps5) 50
	if List(PainSuppression ps6) 60
	if List(PainSuppression ps7) 70    
	if List(PainSuppression ps8) 80 
	if List(PainSuppression ps9) 90 
	if List(PainSuppression ps10) 101 
}

#FlashHeal
AddListItem(FlashHeal fh0 "FlashHeal 0" specialization=1)
AddListItem(FlashHeal fh1 "FlashHeal 10" specialization=1)
AddListItem(FlashHeal fh2 "FlashHeal 20" specialization=1)
AddListItem(FlashHeal fh3 "FlashHeal 30" specialization=1)
AddListItem(FlashHeal fh4 "FlashHeal 40"  specialization=1 default)
AddListItem(FlashHeal fh5 "FlashHeal 50" specialization=1)
AddListItem(FlashHeal fh6 "FlashHeal 60" specialization=1)
AddListItem(FlashHeal fh7 "FlashHeal 70" specialization=1)
AddListItem(FlashHeal fh8 "FlashHeal 80" specialization=1)
AddListItem(FlashHeal fh9 "FlashHeal 90" specialization=1)
AddListItem(FlashHeal fh10 "FlashHeal 100" specialization=1)

AddFunction FlashHealValue asValue=1
{
	if List(FlashHeal fh0) 0
	if List(FlashHeal fh1) 10
	if List(FlashHeal fh2) 20
	if List(FlashHeal fh3) 30
	if List(FlashHeal fh4) 40
	if List(FlashHeal fh5) 50
	if List(FlashHeal fh6) 60
	if List(FlashHeal fh7) 70
	if List(FlashHeal fh8) 80
	if List(FlashHeal fh9) 90
	if List(FlashHeal fh10) 101    
}

#PWShield
AddListItem(PWShield pws0 "PWShield 0" specialization=1)
AddListItem(PWShield pws1 "PWShield 10" specialization=1)
AddListItem(PWShield pws2 "PWShield 20" specialization=1)
AddListItem(PWShield pws3 "PWShield 30" specialization=1)
AddListItem(PWShield pws4 "PWShield 40" specialization=1)
AddListItem(PWShield pws5 "PWShield 50"  specialization=1 default)
AddListItem(PWShield pws6 "PWShield 60" specialization=1)
AddListItem(PWShield pws7 "PWShield 70" specialization=1)
AddListItem(PWShield pws8 "PWShield 80" specialization=1)
AddListItem(PWShield pws9 "PWShield 90" specialization=1)
AddListItem(PWShield pws10 "PWShield 100" specialization=1)

AddFunction PWShieldValue asValue=1
{
	if List(PWShield pws0) 0
	if List(PWShield pws1) 10
	if List(PWShield pws2) 20
	if List(PWShield pws3) 30
	if List(PWShield pws4) 40
	if List(PWShield pws5) 50
	if List(PWShield pws6) 60
	if List(PWShield pws7) 70
	if List(PWShield pws8) 80
	if List(PWShield pws9) 90
	if List(PWShield pws10) 101    
}

#DesperatePrayer
AddListItem(DesperatePrayer dp0 "DesperatePrayer  0" specialization=1)
AddListItem(DesperatePrayer dp1 "DesperatePrayer  10" specialization=1)
AddListItem(DesperatePrayer dp2 "DesperatePrayer  20" specialization=1)
AddListItem(DesperatePrayer dp3 "DesperatePrayer  30" specialization=1)
AddListItem(DesperatePrayer dp4 "DesperatePrayer  40" specialization=1)
AddListItem(DesperatePrayer dp5 "DesperatePrayer  50"  specialization=1 default)
AddListItem(DesperatePrayer dp6 "DesperatePrayer  60" specialization=1)
AddListItem(DesperatePrayer dp7 "DesperatePrayer  70" specialization=1)
AddListItem(DesperatePrayer dp8 "DesperatePrayer  80" specialization=1)
AddListItem(DesperatePrayer dp9 "DesperatePrayer  90" specialization=1)
AddListItem(DesperatePrayer dp10 "DesperatePrayer  100" specialization=1)

AddFunction DesperatePrayerValue asValue=1
{
	if List(DesperatePrayer dp0) 0
	if List(DesperatePrayer dp1) 10
	if List(DesperatePrayer dp2) 20
	if List(DesperatePrayer dp3) 30
	if List(DesperatePrayer dp4) 40
	if List(DesperatePrayer dp5) 50
	if List(DesperatePrayer dp6) 60
	if List(DesperatePrayer dp7) 70
	if List(DesperatePrayer dp8) 80
	if List(DesperatePrayer dp9) 90
	if List(DesperatePrayer dp10) 101    
}

#GreaterHeal
AddListItem(GreaterHeal gh0 "GreaterHeal 0" specialization=1 default)
AddListItem(GreaterHeal gh1 "GreaterHeal 10" specialization=1)
AddListItem(GreaterHeal gh2 "GreaterHeal 20" specialization=1)
AddListItem(GreaterHeal gh3 "GreaterHeal 30" specialization=1)
AddListItem(GreaterHeal gh4 "GreaterHeal 40"  specialization=1)
AddListItem(GreaterHeal gh5 "GreaterHeal 50" specialization=1)
AddListItem(GreaterHeal gh6 "GreaterHeal 60" specialization=1)
AddListItem(GreaterHeal gh7 "GreaterHeal 70" specialization=1)
AddListItem(GreaterHeal gh8 "GreaterHeal 80" specialization=1)
AddListItem(GreaterHeal gh9 "GreaterHeal 90" specialization=1)
AddListItem(GreaterHeal gh10 "GreaterHeal 100" specialization=1)

AddFunction GreaterHealValue asValue=1
{
	if List(GreaterHeal gh0) 0
	if List(GreaterHeal gh1) 10
	if List(GreaterHeal gh2) 20
	if List(GreaterHeal gh3) 30
	if List(GreaterHeal gh4) 40
	if List(GreaterHeal gh5) 50
	if List(GreaterHeal gh6) 60
	if List(GreaterHeal gh7) 70
	if List(GreaterHeal gh8) 80
	if List(GreaterHeal gh9) 90
	if List(GreaterHeal gh10) 101    
}

#Heal
AddListItem(Heal h0 "Heal 0" specialization=1 default)
AddListItem(Heal h1 "Heal 10" specialization=1)
AddListItem(Heal h2 "Heal 20" specialization=1)
AddListItem(Heal h3 "Heal 30" specialization=1)
AddListItem(Heal h4 "Heal 40"  specialization=1)
AddListItem(Heal h5 "Heal 50" specialization=1)
AddListItem(Heal h6 "Heal 60" specialization=1)
AddListItem(Heal h7 "Heal 70" specialization=1)
AddListItem(Heal h8 "Heal 80" specialization=1)
AddListItem(Heal h9 "Heal 90" specialization=1)
AddListItem(Heal h10 "Heal 100" specialization=1)

AddFunction HealValue asValue=1
{
	if List(Heal h0) 0
	if List(Heal h1) 10
	if List(Heal h2) 20
	if List(Heal h3) 30
	if List(Heal h4) 40
	if List(Heal h5) 50
	if List(Heal h6) 60
	if List(Heal h7) 70
	if List(Heal h8) 80
	if List(Heal h9) 90
	if List(Heal h10) 101    
}


#Renew
AddListItem(Renew r0 "Renew 0" specialization=1)
AddListItem(Renew r1 "Renew 10" specialization=1)
AddListItem(Renew r2 "Renew 20" specialization=1)
AddListItem(Renew r3 "Renew 30" specialization=1)
AddListItem(Renew r4 "Renew 40"  specialization=1)
AddListItem(Renew r5 "Renew 50" specialization=1)
AddListItem(Renew r6 "Renew 60" specialization=1)
AddListItem(Renew r7 "Renew 70" specialization=1 default)
AddListItem(Renew r8 "Renew 80" specialization=1)
AddListItem(Renew r9 "Renew 90" specialization=1)
AddListItem(Renew r10 "Renew 100" specialization=1)

AddFunction RenewValue asValue=1
{
	if List(Renew r0) 0
	if List(Renew r1) 10
	if List(Renew r2) 20
	if List(Renew r3) 30
	if List(Renew r4) 40
	if List(Renew r5) 50
	if List(Renew r6) 60
	if List(Renew r7) 70
	if List(Renew r8) 80
	if List(Renew r9) 90
	if List(Renew r10) 101    
}

#PrayerOfHealingHP
AddListItem(PrayerOfHealingHP pohhp0 "PrayerOfHealingHP 0" specialization=1)
AddListItem(PrayerOfHealingHP pohhp1 "PrayerOfHealingHP 10" specialization=1)
AddListItem(PrayerOfHealingHP pohhp2 "PrayerOfHealingHP 20" specialization=1)
AddListItem(PrayerOfHealingHP pohhp3 "PrayerOfHealingHP 30" specialization=1)
AddListItem(PrayerOfHealingHP pohhp4 "PrayerOfHealingHP 40"  specialization=1)
AddListItem(PrayerOfHealingHP pohhp5 "PrayerOfHealingHP 50" specialization=1)
AddListItem(PrayerOfHealingHP pohhp6 "PrayerOfHealingHP 60" specialization=1)
AddListItem(PrayerOfHealingHP pohhp7 "PrayerOfHealingHP 70" specialization=1 default)
AddListItem(PrayerOfHealingHP pohhp8 "PrayerOfHealingHP 80" specialization=1)
AddListItem(PrayerOfHealingHP pohhp9 "PrayerOfHealingHP 90" specialization=1)
AddListItem(PrayerOfHealingHP pohhp10 "PrayerOfHealingHP 100" specialization=1)

AddFunction PrayerOfHealingHPValue asValue=1
{
	if List(PrayerOfHealingHP pohhp0) 0
	if List(PrayerOfHealingHP pohhp1) 10
	if List(PrayerOfHealingHP pohhp2) 20
	if List(PrayerOfHealingHP pohhp3) 30
	if List(PrayerOfHealingHP pohhp4) 40
	if List(PrayerOfHealingHP pohhp5) 50
	if List(PrayerOfHealingHP pohhp6) 60
	if List(PrayerOfHealingHP pohhp7) 70
	if List(PrayerOfHealingHP pohhp8) 80
	if List(PrayerOfHealingHP pohhp9) 90
	if List(PrayerOfHealingHP pohhp10) 101    
}

#PrayerOfHealingNUM
AddListItem(PrayerOfHealingNUM pohnum1 "PrayerOfHealingNUM 1" specialization=1)
AddListItem(PrayerOfHealingNUM pohnum2 "PrayerOfHealingNUM 2" specialization=1)
AddListItem(PrayerOfHealingNUM pohnum3 "PrayerOfHealingNUM 3" specialization=1)
AddListItem(PrayerOfHealingNUM pohnum4 "PrayerOfHealingNUM 4"  specialization=1 default)
AddListItem(PrayerOfHealingNUM pohnum5 "PrayerOfHealingNUM 5" specialization=1)


AddFunction PrayerOfHealingNUMValue asValue=1
{
	if List(PrayerOfHealingNUM pohnum1) 1
	if List(PrayerOfHealingNUM pohnum2) 2
	if List(PrayerOfHealingNUM pohnum3) 3
	if List(PrayerOfHealingNUM pohnum4) 4
	if List(PrayerOfHealingNUM pohnum5) 5
}

#CascadeHaloNUM
AddListItem(CascadeHaloNUM chnum1 "CascadeHaloNUM 1" specialization=1)
AddListItem(CascadeHaloNUM chnum2 "CascadeHaloNUM 2" specialization=1)
AddListItem(CascadeHaloNUM chnum3 "CascadeHaloNUM 3" specialization=1)
AddListItem(CascadeHaloNUM chnum4 "CascadeHaloNUM 4"  specialization=1 default)
AddListItem(CascadeHaloNUM chnum5 "CascadeHaloNUM 5" specialization=1)
AddListItem(CascadeHaloNUM chnum6 "CascadeHaloNUM 6" specialization=1)
AddListItem(CascadeHaloNUM chnum7 "CascadeHaloNUM 7" specialization=1)
AddListItem(CascadeHaloNUM chnum8 "CascadeHaloNUM 8" specialization=1)
AddListItem(CascadeHaloNUM chnum9 "CascadeHaloNUM 9" specialization=1)
AddListItem(CascadeHaloNUM chnum10 "CascadeHaloNUM 10" specialization=1)


AddFunction CascadeHaloNUMValue asValue=1
{
	if List(CascadeHaloNUM chnum1) 1
	if List(CascadeHaloNUM chnum2) 2
	if List(CascadeHaloNUM chnum3) 3
	if List(CascadeHaloNUM chnum4) 4
	if List(CascadeHaloNUM chnum5) 5
	if List(CascadeHaloNUM chnum6) 6
	if List(CascadeHaloNUM chnum7) 7
	if List(CascadeHaloNUM chnum8) 8
	if List(CascadeHaloNUM chnum9) 9
	if List(CascadeHaloNUM chnum10) 10
}


#CascadeHaloHP
AddListItem(CascadeHaloHP chhp0 "CascadeHaloHP 0" specialization=1)
AddListItem(CascadeHaloHP chhp1 "CascadeHaloHP 10" specialization=1)
AddListItem(CascadeHaloHP chhp2 "CascadeHaloHP 20" specialization=1)
AddListItem(CascadeHaloHP chhp3 "CascadeHaloHP 30" specialization=1)
AddListItem(CascadeHaloHP chhp4 "CascadeHaloHP 40"  specialization=1 default)
AddListItem(CascadeHaloHP chhp5 "CascadeHaloHP 50" specialization=1)
AddListItem(CascadeHaloHP chhp6 "CascadeHaloHP 60" specialization=1)
AddListItem(CascadeHaloHP chhp7 "CascadeHaloHP 70" specialization=1)
AddListItem(CascadeHaloHP chhp8 "CascadeHaloHP 80" specialization=1)
AddListItem(CascadeHaloHP chhp9 "CascadeHaloHP 90" specialization=1)
AddListItem(CascadeHaloHP chhp10 "CascadeHaloHP 100" specialization=1)


AddFunction CascadeHaloHPValue asValue=1
{
	if List(CascadeHaloHP chhp0) 0
	if List(CascadeHaloHP chhp1) 10
	if List(CascadeHaloHP chhp2) 20
	if List(CascadeHaloHP chhp3) 30
	if List(CascadeHaloHP chhp4) 40
	if List(CascadeHaloHP chhp5) 50
	if List(CascadeHaloHP chhp6) 60
	if List(CascadeHaloHP chhp7) 70
	if List(CascadeHaloHP chhp8) 80
	if List(CascadeHaloHP chhp9) 90
	if List(CascadeHaloHP chhp10) 101
}



AddFunction PrayerOfHealing
{
	if PrayerOfHealingHPValue() == 10
	{
		if {GetGroupMembersNumBelow(10) >= PrayerOfHealingNUMValue() and Speed() == 0} Spell(PRAYER_OF_HEALING)
	}
	if PrayerOfHealingHPValue() == 20
	{
		if {GetGroupMembersNumBelow(20) >= PrayerOfHealingNUMValue() and Speed() == 0} Spell(PRAYER_OF_HEALING)
	}
	if PrayerOfHealingHPValue() == 30
	{
		if {GetGroupMembersNumBelow(30) >= PrayerOfHealingNUMValue() and Speed() == 0} Spell(PRAYER_OF_HEALING)
	}
	if PrayerOfHealingHPValue() == 40
	{
		if {GetGroupMembersNumBelow(40) >= PrayerOfHealingNUMValue() and Speed() == 0} Spell(PRAYER_OF_HEALING)
	}
	if PrayerOfHealingHPValue() == 50
	{
		if {GetGroupMembersNumBelow(50) >= PrayerOfHealingNUMValue() and Speed() == 0} Spell(PRAYER_OF_HEALING)
	}
	if PrayerOfHealingHPValue() == 60
	{
		if {GetGroupMembersNumBelow(60) >= PrayerOfHealingNUMValue() and Speed() == 0} Spell(PRAYER_OF_HEALING)
	}
	if PrayerOfHealingHPValue() == 70
	{
		if {GetGroupMembersNumBelow(70) >= PrayerOfHealingNUMValue() and Speed() == 0} Spell(PRAYER_OF_HEALING)
	}
	if PrayerOfHealingHPValue() == 80
	{
		if {GetGroupMembersNumBelow(80) >= PrayerOfHealingNUMValue() and Speed() == 0} Spell(PRAYER_OF_HEALING)
	}
	if PrayerOfHealingHPValue() == 90
	{
		if {GetGroupMembersNumBelow(90) >= PrayerOfHealingNUMValue() and Speed() == 0} Spell(PRAYER_OF_HEALING)
	}
	if PrayerOfHealingHPValue() == 101
	{
		if {GetGroupMembersNumBelow(101) >= PrayerOfHealingNUMValue() and Speed() == 0} Spell(PRAYER_OF_HEALING)
	}
}

AddFunction CascadeHalo
{
	if CascadeHaloHPValue() == 10
	{
		if GetMembersNumBelow(10) >= CascadeHaloNUMValue()
		{
			if TalentPoints(halo_talent) Spell(halo)
			if TalentPoints(cascade_talent) Spell(cascade)
		}
	}
	if CascadeHaloHPValue() == 20
	{
		if GetMembersNumBelow(20) >= CascadeHaloNUMValue()
		{
			if TalentPoints(halo_talent) Spell(halo)
			if TalentPoints(cascade_talent) Spell(cascade)
		}
	}
	if CascadeHaloHPValue() == 30
	{
		if GetMembersNumBelow(30) >= CascadeHaloNUMValue()
		{
			if TalentPoints(halo_talent) Spell(halo)
			if TalentPoints(cascade_talent) Spell(cascade)
		}
	}
	if CascadeHaloHPValue() == 40
	{
		if GetMembersNumBelow(40) >= CascadeHaloNUMValue()
		{
			if TalentPoints(halo_talent) Spell(halo)
			if TalentPoints(cascade_talent) Spell(cascade)
		}
	}
	if CascadeHaloHPValue() == 50
	{
		if GetMembersNumBelow(50) >= CascadeHaloNUMValue()
		{
			if TalentPoints(halo_talent) Spell(halo)
			if TalentPoints(cascade_talent) Spell(cascade)
		}
	}
	if CascadeHaloHPValue() == 60
	{
		if GetMembersNumBelow(60) >= CascadeHaloNUMValue()
		{
			if TalentPoints(halo_talent) Spell(halo)
			if TalentPoints(cascade_talent) Spell(cascade)
		}
	}
	if CascadeHaloHPValue() == 70
	{
		if GetMembersNumBelow(70) >= CascadeHaloNUMValue()
		{
			if TalentPoints(halo_talent) Spell(halo)
			if TalentPoints(cascade_talent) Spell(cascade)
		}
	}
	if CascadeHaloHPValue() == 80
	{
		if GetMembersNumBelow(80) >= CascadeHaloNUMValue()
		{
			if TalentPoints(halo_talent) Spell(halo)
			if TalentPoints(cascade_talent) Spell(cascade)
		}
	}
	if CascadeHaloHPValue() == 90
	{
		if GetMembersNumBelow(90) >= CascadeHaloNUMValue()
		{
			if TalentPoints(halo_talent) Spell(halo)
			if TalentPoints(cascade_talent) Spell(cascade)
		}
	}
	if CascadeHaloHPValue() == 101
	{
		if GetMembersNumBelow(101) >= CascadeHaloNUMValue()
		{
			if TalentPoints(halo_talent) Spell(halo)
			if TalentPoints(cascade_talent) Spell(cascade)
		}
	}	
}




AddFunction BuffMeDisci
{
	if not BuffPresent(stamina any=1) Spell(power_word_fortitude)
	if BuffStacks(EVANGELISM) ==5 Spell(ARCHANGEL)
}

AddFunction ManaAndHealthDisci
{
	if player.HealthPercent() <= DesperatePrayerValue() Spell(DESPERATE_PRAYER)
	if ManaPercent() < 75
	{
		if TalentPoints(mindbender_talent) Spell(mindbender)
		if not TalentPoints(mindbender_talent) Spell(shadowfiend)
	}
}

AddFunction AOEHeal
{
 	CascadeHalo()
	if CheckBoxOn(AutoPoHonSpiritShell) and player.BuffPresent(SPIRIT_SHELL) Spell(PRAYER_OF_HEALING)
	if target.IsFriend() 
	{
		PrayerOfHealing()
	}
}

AddFunction TankHeal
{
	if {{CheckBoxOn(AutoDistanceCalculate) and DistanceBetweenUnit(player focus) <= 38} or not CheckBoxOn(AutoDistanceCalculate)}  and focus.IsFriend() and focus.HealthPercent() > 0
	{
		if focus.HealthPercent() <= 20 and player.HealthPercent() >= 50 Spell(VOID_SHIFT) 
		#if focus.HealthPercent() <= PainSuppressionValue() Spell(PAIN_SUPPRESSION)
		if CheckBoxOn(AutoShieldTank) and not focus.DebuffPresent(WEAKENED_SOUL any=1) and not BuffPresent(POWER_WORD_SHIELD) and Spell(POWER_WORD_SHIELD) focus.Spell(POWER_WORD_SHIELD)
		if BuffCountOnAny(PRAYER_OF_MENDING_BUFF) == 0 Spell(PRAYER_OF_MENDING)
	}
}

AddFunction NormalHeal
{
	if target.IsFriend() and target.HealthPercent() > 0
	{
		if target.HealthPercent() <= 70 and {{Speed(more 0) and Glyph(glyph_of_penance)} or {Speed() == 0}} Spell(PENANCE)
		if target.HealthPercent() <= FlashHealValue() and Speed() == 0 Spell(FLASH_HEAL)
		if target.HealthPercent() <= PWShieldValue() and not target.DebuffPresent(WEAKENED_SOUL) Spell(POWER_WORD_SHIELD)
		if target.HealthPercent() <= GreaterHealValue() and Speed() == 0 Spell(GREATER_HEAL)
		if target.HealthPercent() <= HealValue() and Speed() == 0 Spell(HEAL)
		if target.HealthPercent() <= RenewValue() and not target.BuffPresent(RENEW) and Speed(more 0) Spell(RENEW)
	}			
}

AddFunction Dispell
{

}

AddFunction AthonementHeal
{
	if InCombat() or focus.InCombat()
	{
		if {Speed(more 0) and Glyph(glyph_of_penance)} or {Speed() == 0} focus.Spell(PENANCE)
		if TalentPoints(insanity_talent) and Spell(POWER_WORD_SOLACE) Spell(HOLY_FIRE)
		if not TalentPoints(insanity_talent) Spell(HOLY_FIRE)
		if Speed() == 0 Spell(SMITE)
	}
}


AddIcon specialization=1 help=main
{	
	BuffMeDisci()
	ManaAndHealthDisci()
	TankHeal()
	AOEHeal()
	NormalHeal()
	if Speed(more 0) and CheckBoxOn(AutoMoveBuff) 
	{
		if TalentPoints(angelic_feather_talent) and not BuffPresent(121557) Spell(angelic_feather)
	}
	AthonementHeal()	

}


]],
}

